Class: Instamojo::Link

Inherits:
Object
  • Object
show all
Includes:
CommonObject
Defined in:
lib/client/link.rb

Overview

              "title" => "Foo product",
        "description" => "",
               "slug" => "foo-product",
           "shorturl" => "http://imojo.in/ankurfoobar",
                "url" => "https://www.instamojo.com/ankurgel/foo-product/",
        "cover_image" => "https://www.filepicker.io/api/file/BHeefKAARCKGC5l1J29e/convert?w=500&h=500&fit=clip&quality=70",
           "currency" => "INR",
         "base_price" => "0.00",
           "quantity" => nil,
      "quantity_sold" => 2,
  "requires_shipping" => false,
  "ships_within_days" => nil,
         "start_date" => nil,
           "end_date" => nil,
              "venue" => nil,
           "timezone" => nil,
               "note" => nil,
       "redirect_url" => nil,
        "webhook_url" => nil,
             "status" => "Live",
        "enable_pwyw" => false,
        "enable_sign" => false,
"socialpay_platforms" => ""

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonObject

#assign_values, #construct_hash, included, #reload, #reload!, #to_h, #to_json

Constructor Details

#initialize(link, client) ⇒ Link

Returns a new instance of Link.



41
42
43
44
# File 'lib/client/link.rb', line 41

def initialize(link, client)
  assign_values(link)
  @client = client # Reference to client
end

Instance Attribute Details

#base_priceObject

Returns the value of attribute base_price.



32
33
34
# File 'lib/client/link.rb', line 32

def base_price
  @base_price
end

#cover_imageObject

Returns the value of attribute cover_image.



32
33
34
# File 'lib/client/link.rb', line 32

def cover_image
  @cover_image
end

#currencyObject

Returns the value of attribute currency.



32
33
34
# File 'lib/client/link.rb', line 32

def currency
  @currency
end

#descriptionObject

Returns the value of attribute description.



32
33
34
# File 'lib/client/link.rb', line 32

def description
  @description
end

#enable_pwywObject

Returns the value of attribute enable_pwyw.



34
35
36
# File 'lib/client/link.rb', line 34

def enable_pwyw
  @enable_pwyw
end

#enable_signObject

Returns the value of attribute enable_sign.



34
35
36
# File 'lib/client/link.rb', line 34

def enable_sign
  @enable_sign
end

#end_dateObject

Returns the value of attribute end_date.



33
34
35
# File 'lib/client/link.rb', line 33

def end_date
  @end_date
end

#noteObject

Returns the value of attribute note.



34
35
36
# File 'lib/client/link.rb', line 34

def note
  @note
end

#originalObject (readonly)

Returns the value of attribute original.



36
37
38
# File 'lib/client/link.rb', line 36

def original
  @original
end

#quantityObject

Returns the value of attribute quantity.



32
33
34
# File 'lib/client/link.rb', line 32

def quantity
  @quantity
end

#quantity_soldObject

Returns the value of attribute quantity_sold.



33
34
35
# File 'lib/client/link.rb', line 33

def quantity_sold
  @quantity_sold
end

#redirect_urlObject

Returns the value of attribute redirect_url.



34
35
36
# File 'lib/client/link.rb', line 34

def redirect_url
  @redirect_url
end

#requires_shippingObject

Returns the value of attribute requires_shipping.



33
34
35
# File 'lib/client/link.rb', line 33

def requires_shipping
  @requires_shipping
end

#ships_within_daysObject

Returns the value of attribute ships_within_days.



33
34
35
# File 'lib/client/link.rb', line 33

def ships_within_days
  @ships_within_days
end

#shorturlObject

Returns the value of attribute shorturl.



32
33
34
# File 'lib/client/link.rb', line 32

def shorturl
  @shorturl
end

#slugObject

Returns the value of attribute slug.



32
33
34
# File 'lib/client/link.rb', line 32

def slug
  @slug
end

#socialpay_platformsObject

Returns the value of attribute socialpay_platforms.



34
35
36
# File 'lib/client/link.rb', line 34

def socialpay_platforms
  @socialpay_platforms
end

#start_dateObject

Returns the value of attribute start_date.



33
34
35
# File 'lib/client/link.rb', line 33

def start_date
  @start_date
end

#statusObject

Returns the value of attribute status.



34
35
36
# File 'lib/client/link.rb', line 34

def status
  @status
end

#timezoneObject

Returns the value of attribute timezone.



33
34
35
# File 'lib/client/link.rb', line 33

def timezone
  @timezone
end

#titleObject

Returns the value of attribute title.



32
33
34
# File 'lib/client/link.rb', line 32

def title
  @title
end

#urlObject

Returns the value of attribute url.



32
33
34
# File 'lib/client/link.rb', line 32

def url
  @url
end

#venueObject

Returns the value of attribute venue.



33
34
35
# File 'lib/client/link.rb', line 33

def venue
  @venue
end

#webhook_urlObject

Returns the value of attribute webhook_url.



34
35
36
# File 'lib/client/link.rb', line 34

def webhook_url
  @webhook_url
end

Instance Method Details

#archiveObject

Carry out DELETE request on a link



52
53
54
# File 'lib/client/link.rb', line 52

def archive
  @client.archive_link(self.slug)
end

#save(&block) ⇒ Object

Carry out update request on a Link



47
48
49
# File 'lib/client/link.rb', line 47

def save(&block)
  @client.edit_link(self, {}, &block)
end

#to_sObject



56
57
58
# File 'lib/client/link.rb', line 56

def to_s
  sprintf("Instamojo Link(slug: %s, title: %s, shorturl: %s, status: %s)", slug, title, shorturl, status)
end