Class: Sendshapes::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/sendshapes/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, base_url = 'http://widget.sendshapes.com:3000', end_point = 'api3') ⇒ Client

Returns a new instance of Client.



7
8
9
10
# File 'lib/sendshapes/client.rb', line 7

def initialize(api_key, base_url = 'http://widget.sendshapes.com:3000', end_point = 'api3')
  @api_key   = api_key
  @connection = RestClient::Resource.new("#{base_url}/#{end_point}")
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



5
6
7
# File 'lib/sendshapes/client.rb', line 5

def api_key
  @api_key
end

Instance Method Details

#create_transaction(file_path, receiver_email, print_value) ⇒ Object



12
13
14
15
16
# File 'lib/sendshapes/client.rb', line 12

def create_transaction(file_path, receiver_email, print_value)
  post_data = { stl_file: File.new(file_path), api_key: api_key, token: token, receiver_email: receiver_email,
                print_value: print_value }
  post('/api_upload_partner_stl', post_data)['data']['token_link']
end